#pragma once

#include "hotspot.h"
#include "afxcmn.h"
#include "UnivueDlg.h"
#include "MagDialog.h"
#include "DlgFormat.h"
#include "CustomListCtrl.h"
#include <vector>


using namespace std;


// CDlgRecList dialog

class CDlgRecList : public CMagDialog
{
	DECLARE_DYNAMIC(CDlgRecList)

public:
	CDlgRecList(PLAYINFO* p_playInfo, CWnd* pParent = NULL);   // standard constructor
	virtual ~CDlgRecList();

// Dialog Data
	enum { IDD = IDD_DLG_RECLIST };

public:
	CBitmap			m_Skin;
	CHotSpots		m_buttons;
	CHotSpots		m_tabs;
	PLAYINFO*		m_pPlayInfo;
	CString			m_folderPath;
	int				m_filter;		//0: all, 1: normal only, 2: event only, 3: user only
	CImageList		m_imageList;
	CRect			m_rcWin4Resizing;
	int				m_resizingStatus;		//0: none, SKIN_XMOVE ~ SKIN_YEXTEND
	POINT			m_ptDrag;
	CWnd*			m_pParentWnd;
	CDlgFormat*		m_pDlgFormat;
	BOOL			m_bFirstPlay;
	CListCtrl		m_CtlResultList;
	int				m_nLast;
	int				m_nNoLoad;
	BOOL			m_bFirstShow;
	BOOL			m_bLoadFile;

public:
	void			init(PLAYINFO* pPlayInfo = NULL);
	void			prepareSkin();
	void			setBtnPos();
	void			displaySkin(CDC* pDC);
	void			addToList(LPCTSTR recType, CStringList& sList);
	void			doFileList(BOOL bReload = TRUE);
	void			formatMemory();
	void			addToList_Custom(LPCTSTR recType, CStringList& sList);
	void			FileList(const TCHAR *path, CStringList &sList);
	void			GetFilePathAndFile( CString szFileFullPath, CString &szFile, CString &szFilePath );
	BOOL			CheckFileExist(CString &szRetFilePath, CString szFile, int nIndex);
	void			AddFileToCustomList( CString szFileDrop , int nLast =0);

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnInitDialog();

protected:
	virtual void OnCancel();
	virtual void OnOK();

public:
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
public:
	afx_msg void OnDestroy();
	afx_msg void OnPaint();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	CCustomListCtrl m_ListCtrl;
	afx_msg void OnNMDblclkListRec(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMCustomdrawListRec(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnNMClickListRec(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg LRESULT OnNcHitTest(CPoint point);
	afx_msg LRESULT  OnDropFiles(WPARAM wParam,LPARAM lParam);
	afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo) ;

	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
};
